home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-07-20 | 5.7 KB | 160 lines | [TEXT/MPCC] |
- pro Fit Binary Data File Format
-
- -----------------------------------------------------------------
-
- Changed 19.7.96: Corrected some inaccuracies in the description
- of the column info data.
- Added information about some optional entries
- in the resource fork.
-
- -----------------------------------------------------------------
-
-
-
-
- The following is a description of the native binary format that
- pro Fit 5.0 uses for data files. You may use this format if
- you want to exchange large data sets between pro Fit and an
- application of your own.
- For smaller data sets, it may be easier to use text files.
-
-
- You can use this information in any way you want. Note, however,
- that future versions of pro Fit might use different file formats.
-
-
- If you are interested in exchanging binary data with pro Fit through
- the clipboard and with drag and drop, you can also obtain a copy
- of the specifications of the format we use on the scrap. Contact us
- at profit@cherwell.com
-
-
-
- Warning: you will need some experience in programming to understand
- what follows.
-
-
- Type/Creator:
- -------------
-
- The type of data files is 'ftLS'
- The creator of pro Fit files is 'NLft'
-
-
-
- Data fork:
- ----------
-
- The data in the data fork starts with a 5 byte header looking like this:
- Bytes 0-3: 'NLft' (hex 0x4E, 0x4C, 0x66, 0x74)
- Byte 4: 0x0D
-
-
- Then, there follow the names of the columns, separated by tabulators (0x09).
- After the names, there follows a carriage return (0x0D).
-
-
- After the names, there follows a series of arrays data blocks. Each
- data block is preceded by a long integer (4 byte), called the "type" that says what kind
- of data is to follow. type can take the values of -1 (if column information
- follows), 4 if a column of 4-byte float values follows, 8 if a column of 8 byte
- double values follows, or 1 if a string column follows.
-
- The first data block contains column information and has a type -1. The following
- data block contain the data for columns 1, 2, 3, etc. They can have type 1, 4 or 8.
-
- A data block with column information has type -1 (column information)
- and looks as follows:
- 4 bytes: type (= -1)
- 4 bytes: size (long integer) This gives the size in bytes of
- the "column info data" that follows.
- size bytes: the "column info data"
- The "column info data" is an array where each element describes the format of
- one column. Each element looks like this:
-
- typedef struct
- { unsigned char t; // the type of the column:
- // 0 if 4 byte floating point
- // 1 if 8 byte floating point
- // 128 if text column
- unsigned char n; // additional info, depending on value above, by default always set to 0
- // for numeric cols: bits0-3: the number of decimals +1 (0: auto)
- // bit7: 1 if scientific, 0 else
- unsigned char width;// the width of this column divided by 2, 0 if default width
- unsigned char x; // reserved
- } ColType;
-
- The entries in the "column info data" array define the format of columns 1, 2, 3, etc.
- The first entry defines the format of column 1.
-
- The following are the data blocks for column data:
-
- If type is 4 (4 byte floating point column)
- 4 bytes: type (4)
- 4 bytes: size (long integer) This gives the number of floating point values in the column.
- 4*size bytes: the column data, an array of 4 byte floating point numbers.
-
- If type is 8 (8 byte floating point column)
- 4 bytes: type (8)
- 4 bytes: size (long integer) This gives the number of floating point values in the column.
- 8*size bytes: the column data, an array of 8 byte floating point numbers.
-
- If type is 1 (string column)
- 4 bytes: type (=1)
- 4 bytes: size (long integer) The number of bytes in the following "column data".
- size bytes: "column data".
- The column data is a record that looks as follows:
- typedef struct // the data structure of a column of strings
- { long size; // the size in bytes of this record
- long nrRows; // the number of rows of this column
- long firstOffset; // set to 14
- short firstRow; // set to 1
- unsigned char data[MANY]; // here follow the strings (pascal strings), packed, one after another
- } StringData;
- The strings in "data" must be pascal strings, each containing exactly as many characters
- it requires. There are no gaps between the strings.
- Note: All the above records use 68k-struct alignments. This matterls in the
- StringData struct: "data" is at an offset of 14 bytes from the beginning of the
- record.
-
- To learn more, look at the data fork with a file editor.
-
-
-
-
-
- The resource fork
- -----------------
-
- The resource fork holds some optional data. When writing a file, you don't have to
- generate the resources unless you want to override the default values.
- The following is a list of the most important entries:
-
- Type = 'fINF', ID = 128:
- This resource contains the text that appears in the info-field. The text must consist
- of 1-byte roman characters. The length of the resource defines the length of the text.
-
- Type = 'fINF', ID = 129:
- An entry of type "Rect" (8 bytes) with the global coordinates where the window is to
- appear.
-
- Type = 'fINF', ID = 130:
- Information about the font, font size and font style to be used in the window.
- bytes 0 and 1: reserved
- bytes 2 and 3: short size (must be between 3 and 48 for data windows)
- byte 4: the font style (ignored for data windows)
- byte 5: reserved
- bytes 6,7,etc: a Pascal string with the font's name
-
- Type = 'fINF', ID = 131:
- 4 long integer values (totally 16 bytes). The interpretation of these values if different for
- each window type.
- For data windows, the first long integer value (4st for bytes) define the "height" of the
- info field at the top of the window. Set it to 0 if you want to hide the info field, other-
- wise set it to a value between 16 and 100. Set all other 12 bytes of the resource to 0.
-
-
-
-
- Good luck!
-